﻿@using Newtouch.Infrastructure;
@using Newtouch.HIS.Web.Core.Extensions;
@{
    /**/
    ViewBag.Title = "PurchaseBillDetailQuery";
    Layout = "~/Views/Shared/_Form.cshtml";
    //报表链接
    var reportUrl = Newtouch.Core.Common.Utils.ConfigurationHelper.GetAppConfigValue("ReportUrl");
    var reportSystemCode = Newtouch.Core.Common.Utils.ConfigurationHelper.GetAppConfigValue("ReportSystemCode");
}

<div class="rows">
    <div class="panel panel-default">
        <table class="form">
            <tr>
                <th class="formTitle "><span class="required">*</span>药企：</th>
                <td class="formValue">
                    <input type="text" id="yq" name="yq" class="form-control" placeholder="请选择药企" autocomplete="off" style="width:60%" />
                    <input type="hidden" id="yqbm" />
                </td>
                <th class="formTitle">开始日期：</th>
                <td class="formValue">
                    <input id="kssj" type="text" class="form-control input-wdatepicker form-an" style="width: 130px;"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss'})" value="@(DateTime.Now.ToString("yyyy-MM-01 00:00:00"))" />
                </td>
                <th class="formTitle" style="padding-right:5px;">结束日期：</th>
                <td class="formValue">
                    <input id="jssj" type="text" class="form-control input-wdatepicker form-an" style="width:130px"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" value="@(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"))" />
                </td>
                <th class="formTitle"></th>
                <td class="formValue" style="padding-left:20px;">
                    <input type="button" id="btn_search" onclick="submit();" class="btn btn-primary btn-md" value="查询" style="width:55px" />
                </td>
            </tr>
        </table>
    </div>
    <input type="text" id="zxys" hidden="hidden" />
</div>

<div class="ui-layout" id="layout" style="height:100%;width:100%;">
    <iframe class="ui-layout-center" style="width:100%;" id="iframerightiframerightiframerightttt" name="iframerightiframerightiframerightttt"
            scrolling="auto" allowtransparency="true" frameborder="0"></iframe>
</div>

<script type="text/javascript">


    $(function () {
        InitFloat();
    });


    //初始化浮层
    function InitFloat() {
        //药企
        $("#yq").newtouchBatchFloatingSelector({
            clickautotrigger: true,
            height: 200,
            width: 400,
            url: "/Medicine/MedicineSupplierList",
            ajaxmethod: 'Get',
            ajaxreqdata: function () {
                var reqData = {};
                reqData.keyword = $.trim($("#yq").val());
                return reqData;
            },
            colModel: [
                { label: '药企编码', name: 'gysCode', widthratio: 30 },
                { label: '药企', name: 'gysmc', widthratio: 70 }
            ],
            itemdbclickhandler: function ($thistr) {
                $("#yqbm").val($thistr.attr('data-gysCode'));
                $("#yq").val($thistr.attr('data-gysmc'));
                return;
            }
        });
    }

    function submit() {
        if ($('#kssj').val().length == 0) {
            $.modalAlert("缺少开始时间", "error");
            return;
        }
        if ($('#jssj').val().length == 0) {
            $.modalAlert("缺少结束时间", "error");
            return;
        }
        if ($('#kssj').val() > $('#jssj').val()) {
            $.modalAlert("开始时间不能大于结束时间", "error");
            return;
        }
        var yfcode = "@Newtouch.Infrastructure.Constants.CurrentYfbm.yfbmCode";
        var uri = '@reportUrl' + "?tempCode=1254" + "&hospitalCode=" + '@ViewBag.OrganizeId' + "&systemCode=" + '@reportSystemCode';
        uri += "&kssj=" + $('#kssj').val() + "&jssj=" + $('#jssj').val() + "&yqbm=" + $("#yqbm").val();
        setTimeout("$.loading(true, '正在请求报表页面...');", 10);
        $("#iframerightiframerightiframerightttt").attr('src', uri);
    }

    $("#iframerightiframerightiframerightttt").load(function () {
        $.loading(false);
    });

    $(function () {
        var h = $(window).height() - 55
        $('#layout iframe').css('height', h);
    });

    //刷新列表
    function refReport() {
        $("#btn_search").trigger('click');
    }

</script>
